package com.mx.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mx.entity.Person;
@Repository  //数据库层
public class ExportExcelDaoImpl {
	@Autowired
	 private  SessionFactory  sessionfactory;
	 /**
	 * 获取需要导出的数据
	 */
	public List<Person> getExcelData(){
		Session session=sessionfactory.openSession();
        Query  query=session.createQuery("from Person");
        List<Person> list=query.list();
		  session.close();
        return list;
	 }
	//导入数据
	public void uploadUserInfoExcel(Person  person){
		Session session=sessionfactory.openSession();
         session.save(person);
		 session.close();
        
	 }
}
